package com.ccys.cms.controller.corporateAndInsurance;

import com.ccys.cms.service.corporateAndInsurance.OnboardingScreensService;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.corporateAndInsurance.OnboardingScreensDetailDto;
import com.ccys.db.dto.corporateAndInsurance.OnboardingScreensDto;
import com.ccys.db.vo.corporateAndInsurance.OnboardingScreensListSelectVo;
import com.ccys.db.vo.corporateAndInsurance.OnboardingScreensPageQueryVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * @program: WhiteCoat
 * @description: 演示接口
 * @author: ZhangJingCan
 * @create: 2023-12-20 15:08
 **/

@RestController
@RequestMapping("corporateAndInsurance")
@Api(tags = "corporateAndInsurance-演示接口")
public class OnboardingScreensController {

    @Autowired
    private OnboardingScreensService onboardingScreensService;


    @PostMapping("onboardingScreens")
    @ApiOperation("保存演示")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "name", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "display", value = "display", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "cta", value = "新增/修改时显示:Last screen button text", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "routeUsers", value = "0-subscription,1-GP,2-mentalWellness,3-peadiatric", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult saveOnboardingScreens(@ApiIgnore OnboardingScreensDto dto) {
        return onboardingScreensService.saveOnboardingScreens(dto);
    }

    @DeleteMapping("onboardingScreens")
    @ApiOperation("根据ID删除演示")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult deleteOnboardingScreens(@ApiIgnore OnboardingScreensDto dto) {
        return onboardingScreensService.deleteOnboardingScreens(dto);
    }


    @GetMapping("onboardingScreens")
    @ApiOperation("分页查询演示")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "name模糊查询", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "0/1,查询所有传null", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "startDate", value = "开始日期,格式:yyyy-MM-dd", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期,格式:yyyy-MM-dd", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "orderByStr",
                    value = "(默认传：t1.created_on descend),(左到右依次:t1.name,t1.display,t1.status,t2.user_fullname,t1.created_on,t1.updated_on)",
                    required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult<PageInfo<OnboardingScreensPageQueryVo>, Object> findPageOnboardingScreens(@ApiIgnore OnboardingScreensDto dto) {
        return onboardingScreensService.findPageOnboardingScreens(dto);
    }


    @PutMapping("onboardingScreens/status")
    @ApiOperation("根据ID修改演示状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态：0-禁用，1-启用", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult updateOnboardingScreensStatus(@ApiIgnore OnboardingScreensDto dto) {
        return onboardingScreensService.updateOnboardingScreensStatus(dto);
    }

    @GetMapping("onboardingScreens/onboardingScreensDetail")
    @ApiOperation("根据ID查询详情数据集合")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "onboardingScreensId", value = "演示主数据ID", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult<PageInfo<OnboardingScreensPageQueryVo>, Object> findListOnboardingScreensDetail(@ApiIgnore OnboardingScreensDetailDto dto) {
        return onboardingScreensService.findListOnboardingScreensDetail(dto);
    }

    @PostMapping("onboardingScreens/onboardingScreensDetail")
    @ApiOperation("保存演示详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "androidImage", value = "androidImage", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "iosImage", value = "iosImage", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult saveOnboardingScreensDetail(@ApiIgnore OnboardingScreensDetailDto dto) {
        return onboardingScreensService.saveOnboardingScreensDetail(dto);
    }

    @PutMapping("onboardingScreens/onboardingScreensDetail/dispOrder")
    @ApiOperation("根据详情ID修改序号")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "dispOrder", value = "序号", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult updateOnboardingScreensDetailOrder(@ApiIgnore OnboardingScreensDetailDto dto) {
        return onboardingScreensService.updateOnboardingScreensDetailOrder(dto);
    }

    @DeleteMapping("onboardingScreensDetail")
    @ApiOperation("根据ID删除演示详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult deleteOnboardingScreensDetail(@ApiIgnore OnboardingScreensDetailDto dto) {
        return onboardingScreensService.deleteOnboardingScreensDetail(dto);
    }

    @GetMapping("onboardingScreens/listSelect")
    @ApiOperation("查询演示下拉列表，只返回了：(id、name)")
    public ResponseResult<List<OnboardingScreensListSelectVo>, Object> listSelect() {
        return onboardingScreensService.listSelect();
    }

}
